//
//  BCUserInfoView.m
//  BangcaiBuy
//
//  Created by lsy on 16/6/15.
//  Copyright © 2016年 BCB. All rights reserved.
//

#import "BCUserInfoView.h"
#import "BCUserInfoCell.h"
@implementation BCUserInfoView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView

{
    self.InfoList = @[@"店铺名", @"联系人", @"手机号", @"所在地区", @"详细地址"];
    self.placeHolderList = @[@"请输入店铺名", @"请输入联系人姓名", @"请输入联系人手机号", @"请选择城市和区域", @"请输入联系人手机号"];
    self.table = [[UITableView alloc] initWithFrame:self.frame style:UITableViewStylePlain];
    [self addSubview:self.table];
    self.table.delegate = self;
    self.table.dataSource = self;
    [self.table registerClass:[BCUserInfoCell class] forCellReuseIdentifier:@"reuse"];
    self.table.rowHeight = 46;
    self.table.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.table.allowsSelection = NO;
    UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 200)];
    UIImageView *image = [[UIImageView alloc] init];
    [headView addSubview:image];
    self.table.tableHeaderView = headView;

 
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.and.width.mas_equalTo(100);
        make.centerX.equalTo(headView);
        make.centerY.equalTo(headView).with.offset(32);
        
    }];

    image.backgroundColor = [UIColor colorWithRed:0.325  green:0.564  blue:0.386 alpha:1];
    image.layer.cornerRadius = 50;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.InfoList.count;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    BCUserInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reuse"];
    cell.infoName = self.InfoList[indexPath.row];
    cell.placeholder = self.placeHolderList[indexPath.row];
    return cell;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
